package demo08;

import java.security.Key;

public class Laptop {
    public void run(){
        System.out.println("电脑屏幕开启，笔记本电脑运行");
    }
    public void useUSBDevice(USB usb){
        if(usb!=null){
            usb.open();
            if(usb instanceof Mouse){
                Mouse mouse=(Mouse)usb;
                mouse.click();
//                ((Mouse) usb).click();
            }
            else if(usb instanceof Keyboard){
                Keyboard keyboard=(Keyboard) usb;
                keyboard.type();
//                ((Keyboard) usb).kick();
            }
            usb.close();
        }


    }
    public void shutDowm(){
        System.out.println("电脑屏幕关闭，笔记本电脑关机");
    }


}
